﻿@model ITS.Core.ViewModel.Users.CreateUserViewModel
@{
    ViewBag.Title = "EditUser";
}
@using (Html.BeginForm())
{
    @Html.HiddenFor(m => m.UserID)
    <div class="editor-label">
        User email:
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(m => m.Username, new { @class = "Textbox", autocomplete = "off" })
        <span>Email of user.</span>
    </div>
    <div class="editor-label">
        Assign password:
    </div>
    <div class="editor-field">
        @Html.PasswordFor(m => m.Password, new { @class = "Textbox", autocomplete = "off" })
        <span>Leave it emtpy if you don't want to change.</span>
    </div>
    <br />
    <fieldset>
        <legend>User's roles</legend>
        @for (int i = 0; i < Model.SelectRoleModels.Count; i++)
        {
            @Html.HiddenFor(m => m.SelectRoleModels[i].RoleID)
            @Html.HiddenFor(m => m.SelectRoleModels[i].RoleName)
            <div class="editor-label">
                <span>
                    @Html.CheckBoxFor(model => model.SelectRoleModels[i].Checked, new { @class = "Checkbox" })
                </span><span>
                    @Model.SelectRoleModels[i].RoleName</span>
            </div>
        }
    </fieldset>
    <div class="editor-label">
        Comment:
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(m => m.Description, new { @class = "Textbox" })
        <span>Comment for this user.</span>
    </div>
    <p>
        <input type="submit" value="Save" id="submit_toogle" /></p>
    <p>@Html.ActionLink("Cancel", "Users", "User")</p>
}